Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • 2 Votes
    7 Posts
    415 Views
    jamesJ
    Hello @i.fritz Thanks for providing these details. Inside you config I can see something shady: MinSpareServers 20 MaxSpareServers 20 But MaxSpareServers should be MaxSpareServers >= MinSpareServers+1 so at least 21. Just in case this could cause any issues. @i.fritz said in Nextcloud Talk CHAT very slow: I see CPU at a lot of Apache processes As expected when you start StartServers 50 and a minimum of MinSpareServers 20 so at least 70 processes. So maybe this config is already a bit shady. <!-- Disclaimer - the following contains partly AI generated content --!> I've done my due diligance to confirm that everything is correct and sane. Made the AI format my sloppy text into something readable. <!-- End of disclaimer --!> For a Nextcloud setup with 100+ users, the Apache prefork MPM settings should balance performance, stability, and resource efficiency. Below are recommended values based on typical production environments, alongside key considerations: Recommended Apache Prefork Settings <IfModule mpm_prefork_module> StartServers 5 MinSpareServers 5 MaxSpareServers 10 MaxRequestWorkers 100 # Previously "MaxClients" MaxConnectionsPerChild 5000 </IfModule> Explanation & Rationale StartServers 5 Initial processes to handle traffic spikes at startup. Why? Avoids delay in spawning processes during sudden load. MinSpareServers 5 MaxSpareServers 10 Maintains 5–10 idle processes to absorb traffic surges. Why? Prevents latency by keeping workers ready. For 100+ users, higher spares reduce wait times during concurrency peaks. MaxRequestWorkers 100 Maximum simultaneous requests. Why? Assumes 10–20% concurrent active users (10–20 requests at peak). Each user may open 2–5 connections (pages, syncs, uploads). Adjust based on RAM: Estimate RAM/process: Minimal: 30–50 MB (optimized PHP). Typical: 70–150 MB (with PHP modules). Formula: MaxRequestWorkers = (Available RAM for Apache) / (Average PHP process size) Example: 8 GB RAM server → Reserve 4 GB for Apache → 4000 MB / 50 MB ≈ 80 workers. Start with 100, monitor, and adjust. MaxConnectionsPerChild 5000 Recycle processes after 5000 requests. Why? Prevents memory leaks without excessive process recycling. Avoid values <1000 (causes frequent restart overhead). Values >10k are acceptable if leaks are minimal. Critical Considerations PHP Memory: Set php.ini values:max_execution_time = 300 ; For large uploads/ops Cloudron sets this for PHP by default: RUN crudini --set /etc/php/8.3/apache2/php.ini PHP upload_max_filesize 5G && \ crudini --set /etc/php/8.3/apache2/php.ini PHP post_max_size 5G && \ crudini --set /etc/php/8.3/apache2/php.ini PHP memory_limit 512M && \ crudini --set /etc/php/8.3/apache2/php.ini opcache opcache.enable 1 && \ crudini --set /etc/php/8.3/apache2/php.ini opcache opcache.enable_cli 1 && \ crudini --set /etc/php/8.3/apache2/php.ini opcache opcache.interned_strings_buffer 32 && \ crudini --set /etc/php/8.3/apache2/php.ini opcache opcache.max_accelerated_files 10000 && \ crudini --set /etc/php/8.3/apache2/php.ini opcache opcache.memory_consumption 128 && \ crudini --set /etc/php/8.3/apache2/php.ini opcache opcache.save_comments 1 && \ crudini --set /etc/php/8.3/apache2/php.ini opcache opcache.revalidate_freq 1 && \ crudini --set /etc/php/8.3/apache2/php.ini Session session.save_path /run/nextcloud/sessions && \ crudini --set /etc/php/8.3/apache2/php.ini Session session.gc_probability 1 && \ crudini --set /etc/php/8.3/apache2/php.ini Session session.gc_divisor 100 Adjustment Workflow Start with recommended values. Simulate load with tools like ab:ab -n 1000 -c 50 https://your-nextcloud.com/ Note: Do not start the load test from your desktop machine at home or the Nextcloud server itself. It should be a VM with enough power. Maybe rent a bigger Hetzner vServer for 30–60 minutes to do the load test against your Nextcloud. Monitor: RAM usage (avoid >70% total usage). Idle workers (should rarely hit 0). Queue length (via mod_status; requests waiting for workers). Scale incrementally: Increase MaxRequestWorkers if queues form. Reduce MaxSpareServers if idle processes waste RAM. With these setting your Nextcloud should at least be assigned 8GB RAM, but since you have 128 GB why not give it 12GB. This might already help.